package com.xxq.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.xxq.common.valid.AddGroup;
import com.xxq.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 商品属性
 * 
 * @author xxq
 * @email 1607903138@qq.com
 * @date 2022-04-28 20:20:14
 */
@Data
@TableName("pms_attr")
@JsonInclude(value= JsonInclude.Include.NON_NULL)
public class AttrEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 属性id
	 */
	@TableId
	@Null(message = "新增时attrI必须为空", groups = {AddGroup.class})
	private Long attrId;
	/**
	 * 属性名
	 */
	@NotNull(message = "attrName不能为空", groups = {AddGroup.class})
	private String attrName;
	/**
	 * 是否需要检索[0-不需要，1-需要]
	 */
	@Range(message = "searchType必须为[0-不需要，1-需要]之一",
			groups = {AddGroup.class, UpdateGroup.class},
			min = 0, max = 1)
	@NotNull(message = "searchType不能为空，[0-不需要，1-需要]", groups = {AddGroup.class})
	private Integer searchType;
	/**
	 * 属性图标
	 */
	@URL(message = "icon必须是合法的url地址", groups = {AddGroup.class, UpdateGroup.class})
	@NotNull(message = "icon不能为空", groups = {AddGroup.class})
	private String icon;
	/**
	 * 可选值列表[用逗号分隔]
	 */
	@NotNull(message = "valueSelect不能为空", groups = {AddGroup.class})
	private String valueSelect;
	/**
	 * 属性类型[0-销售属性，1-基本属性，2-既是销售属性又是基本属性]
	 */
	@Range(message = "attrType必须为[0-销售属性，1-基本属性，2-既是销售属性又是基本属性]之一",
			groups = {AddGroup.class, UpdateGroup.class},
			min = 0, max = 2)
	@NotNull(message = "attrType不能为空，[0-销售属性，1-基本属性，2-既是销售属性又是基本属性]", groups = {AddGroup.class})
	private Integer attrType;
	/**
	 * 启用状态[0 - 禁用，1 - 启用]
	 */
	@Range(message = "enable必须为[0 - 禁用，1 - 启用]之一",
			groups = {AddGroup.class, UpdateGroup.class},
			min = 0, max = 1)
	@NotNull(message = "enable不能为空，启用状态[0 - 禁用，1 - 启用]", groups = {AddGroup.class})
	private Long enable;
	/**
	 * 所属分类
	 */
	@NotNull(message = "catelogId不能为空", groups = {AddGroup.class})
	private Long catelogId;
	/**
	 * 快速展示【是否展示在介绍上；0-否 1-是】，在sku中仍然可以调整
	 */
	@Range(message = "showDesc必须为[0-否 1-是]之一",
			groups = {AddGroup.class, UpdateGroup.class},
			min = 0, max = 1)
	@NotNull(message = "showDesc不能为空，[是否展示在介绍上；0-否 1-是]", groups = {AddGroup.class})
	private Integer showDesc;
	/**
	 * 所属分类名字
	 */
	@TableField(exist = false)
	private String catelogName;
	/**
	 * 所属分组名字
	 */
	@TableField(exist = false)
	private String groupName;
	/**
	 * 属性分组id
	 */
	@TableField(exist = false)
	private Long attrGroupId;
	/**
	 * 所属分组路径
	 */
	@TableField(exist = false)
	private Long[] catelogPath;

}
